import * as step from '@flow-step/step-toolkit'
import fs from 'fs'

export async function installKubectl(version: string) {
    let toolName: string = 'kubectl'
    step.info(`Try to install the kubectl with version ${version}`)

    const installPath = await step.tool.install(toolName, version)
    fs.chmodSync(`${installPath}/kubectl-${version}`, 0o755)

    step.addPath(installPath)
    return installPath
}